home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group92c.txt / 000078_icon-group-sender _Tue Nov 10 13:31:18 1992.msg < prev    next >
Internet Message Format  |  1993-01-04  |  4KB

  1. Received: by cheltenham.cs.arizona.edu; Thu, 12 Nov 1992 16:09:21 MST
  2. Date: 10 Nov 92 13:31:18 GMT
  3. From: destroyer!news.iastate.edu!kelvin@gumby.wisc.edu  (Kelvin Don Nilsen)
  4. Organization: Iowa State University, Ames IA
  5. Subject: Re: file scanning
  6. Message-Id: <kelvin.721402278@kickapoo.cs.iastate.edu>
  7. References: <199211092202.AA25256@optima.cs.arizona.edu>
  8. Sender: icon-group-request@cs.arizona.edu
  9. To: icon-group@cs.arizona.edu
  10. Status: R
  11. Errors-To: icon-group-errors@cs.arizona.edu
  12.  
  13. In <199211092202.AA25256@optima.cs.arizona.edu> "Kenneth Walker" <kwalker@cs.arizona.edu> writes:
  14.  
  15. >Kelvin Nilsen's Conicon has a stream data type the subsumes files and
  16. >supports a type of scanning. His scanning doesn't have tab() and move()
  17. >instead it has probe() and advance() which aslo replace read(). While
  18. >you can backtrack during scanning, I think there are limitations on
  19. >explicitly scanning backwards. He allows for infinite streams along the
  20. >lines of Unix pipes. I know he does some careful buffering to make
  21. >things work.
  22.  
  23. patterns that require backtracking keep a pointer to the backtracking
  24. point in the suspended scanning expression's activation frame.
  25. this prevents the garbage collector from reclaiming that part of 
  26. the stream that might need to be revisited.  once control leaves
  27. the bounded expression that holds the suspended scanning expression,
  28. the backtrack point no longer exist, and the garbage collector
  29. is free to reclaim that part of the stream that is known never to be
  30. visited again.
  31.  
  32. >For files that support seek(), it should be possible to do scanning
  33. >with buffering as you suggested. It means that every file must be
  34. >buffered within the Icon run-time system and all string analysis
  35. >functions have to be changed to work on files and extend the buffer
  36. >when needed. Note that seeking backwards in a file using translation
  37. >mode on systems that have multi-character line termination (like
  38. >MS-DOS) may be a little tricky.
  39.  
  40. i avoided backward seeks by placing restrictions on the legal argument
  41. values for advance() and probe().  in particular, it was not legal to 
  42. specify negative indices.  
  43.  
  44. >There is the question of where you put the buffer. Putting it in the
  45. >string region makes some string handling operations easier; portions
  46. >of the input are normal strings. However, it may be necessary to copy
  47. >the buffer to the end of the region to extent it. How do you decide how
  48. >much to copy? Suppose you backtrack past a point where you did a read-ahead
  49. >to extend the buffer; you probably don't want to loose the read-ahead.
  50. >How do you handle that? I haven't look closely at Kelvin's work in
  51. >several years, so I don't recall how he does these things. But it doesn't
  52. >sound trivial.
  53.  
  54. in my work, i was experimenting with language design as well as
  55. implementation techniques.  i did not use icon's traditional garbage
  56. collector.  the closest Icon analog to the data structures i used is 
  57. a list of strings.  in the event that your pattern spans the boundary 
  58. between two list elements, the underlying implementation replaces one
  59. of the two neighboring elements with the catenation of the two and removes
  60. the second list element.
  61.  
  62. in theory, this could be done entirely within Icon, but you would need to 
  63. implement all of Icon's built-in scanning functions from scratch.  it
  64. would likely run much slower than traditional scanning, but perhaps you
  65. are willing to tolerate the performance problems in return for the increased
  66. expressive power.
  67.  
  68.  
  69. Kelvin Nilsen/Dept. of Computer Science/Iowa State University/Ames, IA  50011 
  70.  (515) 294-2259   kelvin@cs.iastate.edu  uunet!kelvin@cs.iastate.edu
  71.  
  72. --
  73.  
  74. Kelvin Nilsen/Dept. of Computer Science/Iowa State University/Ames, IA  50011 
  75.  (515) 294-2259   kelvin@cs.iastate.edu  uunet!kelvin@cs.iastate.edu
  76.